import time
from itertools import dropwhile

from selenium import webdriver
from selenium.webdriver.common.by import By

driver =webdriver.Edge()
driver.get('http://127.0.01/ranzhi/www')
time.sleep(1)

# 用户名密码
driver.find_element("xpath",'//*[@id="account"]').send_keys("admin")
driver.find_element("xpath",'//*[@id="password"]').send_keys("123456")
# 点击登录
driver.find_element("xpath",'//*[@id="submit"]').click()
time.sleep(2)

# 点击后台管理
driver.find_element("xpath",'//*[@id="s-menu-superadmin"]/button/i').click()

# 切换到iframe
# 定位到iframe
iframe=driver.find_element('id','iframe-superadmin')
driver.switch_to.frame(iframe)

# 点击添加成员
driver.find_element("class name","shortcut.user").click()

# 切换到上一层
driver.switch_to.default_content()
# driver.switch_to.parent_frame()
# driver.back()

# 点击签退
driver.find_element('class name','sign.signout').click()
time.sleep(5)